#!/usr/local/bin/php
<?php
if ($_SERVER['argc']!=2) {
    echo $_SERVER['argv'][0],' STRING',"\n";
    exit(1);
}
$str=iconv('utf-8','utf-16',$_SERVER['argv'][1]);
for ($i=2;$i<strlen($str);$i+=2) {
    echo '&#'.current(unpack('n',$str[$i].$str[$i+1])).';'; 
}
echo "\n";
